filename = 'Chapter 10--文件和异常/practice1/learning_python.txt'
# with open(filename) as file_object:
#     contents = file_object.read()
# print(contents)

# with open(filename) as file_object:
#     for line in file_object:
#         print(line.rstrip())

# with open(filename) as file_object:
#     lines = file_object.readlines()
# pi_string = ''
# for line in lines:
#     pi_string += line.strip()
# print(pi_string)

with open(filename) as file_object:
    for line in file_object.readlines():
        line = line.replace('Python', 'Java')
        print(line.rstrip())
